package com.cloud.alibaba;

import com.cloud.alibaba.domain.Author;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 刘志强
 * @date 2020/11/17 09:29
 * @EnableDiscoveryClient 启动客户端
 */
@EnableDiscoveryClient
@SpringBootApplication
@Slf4j
@RestController
public class ProducerApplication implements CommandLineRunner {

    @Autowired
    private Author author;

    public static void main(String[] args) {
        SpringApplication.run(ProducerApplication.class, args);
    }

    @Override
    public void run(String... args) {
        log.info("producer已启动");
        log.info(author.toString());
    }

    @GetMapping("/test")
    public String test() {
        return author.toString();
    }
}
